<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="shortcut icon" href="favicon.ico"> <link href="__admin_path__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__admin_path__/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__admin_path__/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__admin_path__/css/animate.css" rel="stylesheet">
    <link href="__admin_path__/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__admin_path__/css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <!-- <link href="__admin_path__/css/form/bootstrap.min.css" rel="stylesheet"> -->
    <link href="__admin_path__/css/form/bootstrap-fileinput.css" rel="stylesheet">

    <!-- layui -->
    <link href="__admin_path__/js/plugins/layui/css/layui.css" rel="stylesheet">
    <!-- webuploader -->
    <link rel="stylesheet" href="__admin_path__/js/plugins/webuploader/webuploader.css">

    <script src="__admin_path__/js/form/jquery.min.js"></script>
    <script src="__admin_path__/js/form/bootstrap-fileinput.js"></script>
    <script>
        var uploadConfig = {
        'editormd_upload_url': '{:url("admin/attachment/upload", ["dir" => "images", "from" => "editormd", "module" => request()->module()])}',
        'ueditor_upload_url': '{:url("admin/attachment/upload", ["dir" => "images", "from" => "ueditor", "module" => request()->module()])}',
        'wangeditor_upload_url': '{:url("admin/attachment/upload", ["dir" => "images", "from" => "wangeditor", "module" => request()->module()])}',
        'ckeditor_img_upload_url': '{:url("admin/attachment/upload", ["dir" => "images", "from" => "ckeditor", "module" => request()->module()])}',
        'WebUploader_swf': '__admin_path__/assets/lib/webuploader/Uploader.swf',
        'file_upload_url': '{:url("admin/attachment/upload", ["dir" => "files", "module" => request()->module()])}',
        'image_upload_url': '{:url("admin/attachment/upload", ["dir" => "images", "module" => request()->module()])}',
        };
    </script>
    <style>
        #side-menu a.active{
            color:#fff;
        }
        .yes{
            color:#23b7e5;
        }
        body.full-height-layout #wrapper, body.full-height-layout #page-wrapper{
            background-color: #f0f3f4;
        }
        .navbar-static-top{
            position: fixed;
            z-index: 1000;
            width:calc(100% - 220px);
        }
        #image-view{
            max-width:100px;
        }
        .file-item .success {
        background: rgba(25, 167, 75, 0.78);
    }
    .file-item.thumbnail .remove-picture {
        position: absolute;
        right: -5px;
        top: -5px;
        font-size: 18px;
        color: #CA4949;
        cursor: pointer;
        z-index: 5;
    }
    .file-item .error, .file-item .success {
        position: absolute;
        top: 4px;
        left: 4px;
        right: 4px;
        color: white;
        text-align: center;
        height: 20px;
        font-size: 14px;
        line-height: 20px;
    }
    .file-item.thumbnail {
        display: inline-block;
        position: relative;
        margin-right: 15px;
        float: left;
    }
    .thumbnail {
        display: block;
        padding: 4px;
        margin-bottom: 20px;
        line-height: 1.42857143;
        background-color: #fff;
        border: 1px solid #ddd;
        border-radius: 4px;
        -webkit-transition: border .2s ease-in-out;
        -o-transition: border .2s ease-in-out;
        transition: border .2s ease-in-out;
    }
    .webuploader-pick{
        padding:5px 15px;
    }
    </style>
    {block name="link"}{/block}
</head>

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
    <div id="wrapper">
        <!--左侧导航开始-->
        {include file="public/left" /}
        <!--左侧导航结束-->
        <!--右侧部分开始-->
        <div id="page-wrapper" class="gray-bg dashbard-1">
            <div class="row border-bottom">
            	{include file="public/top"}
            </div>
            <div class="row J_mainContent" style="margin-top: 50px;">
                {block name="main"}{/block}
            </div>
        </div>
        <!--右侧部分结束-->
    </div>
    <audio id="bgMusic" style="display: none;">
        <source = src="__admin_path__/iosnewmessage.mp3" type="audio/mp3">
    </audio>
    <!-- 全局js -->
    <script src="__admin_path__/js/jquery.min.js?v=2.1.4"></script>
    <script src="__admin_path__/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__admin_path__/js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="__admin_path__/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <script src="__admin_path__/js/plugins/layer/layer.min.js"></script>

    
    <!-- 第三方插件 -->
    <!-- <script src="__admin_path__/js/plugins/pace/pace.min.js"></script> -->
    <!-- iCheck -->
    <script src="__admin_path__/js/plugins/iCheck/icheck.min.js"></script>
    <script src="__admin_path__/js/plugins/layui/layui.js"></script>
    <script src="__admin_path__/js/plugins/webuploader/webuploader.min.js"></script>
    <script src="__admin_path__/js/plugins/ueditor/ueditor.config.js"></script>
    <script src="__admin_path__/js/plugins/ueditor/ueditor.all.min.js"></script>
    <script src="__admin_path__/js/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>

    <script src="__admin_path__/js/plugins/toastr/toastr.min.js"></script>
    <!-- 自定义js -->
    <script src="__admin_path__/js/hAdmin.js?v=4.1.0"></script>
    <script src="__admin_path__/js/index.js"></script>
    <script>
        if (typeof console == "undefined") {    this.console = { log: function (msg) {  } };}
    // 如果浏览器不支持websocket，会使用这个flash自动模拟websocket协议，此过程对开发者透明
    WEB_SOCKET_SWF_LOCATION = "/swf/WebSocketMain.swf";
    // 开启flash的websocket debug
    WEB_SOCKET_DEBUG = true;
    var ws, name, client_list={};

        /**
         * 与GatewayWorker建立websocket连接，域名和端口改为你实际的域名端口，
         * 其中端口为Gateway端口，即start_gateway.php指定的端口。
         * start_gateway.php 中需要指定websocket协议，像这样
         * $gateway = new Gateway(websocket://0.0.0.0:7272);
         */
        ws = new WebSocket("ws://116.55.241.85:7272");
        // 服务端主动推送消息时会触发这里的onmessage
        ws.onmessage = function(e){
            // json数据转换成js对象
            var data = eval("("+e.data+")");
            var type = data.type || '';
            switch(type){
                // Events.php中返回的init类型的消息，将client_id发给后台进行uid绑定
                case 'init':
                    // 利用jquery发起ajax请求，将client_id发给后端进行uid绑定
                    $.post('{:url("admin/Gatewaybind/bind")}', {client_id: data.client_id}, function(data){
                        
                    }, 'json');
                    break;
                case 'ping':
                    ws.send('{"type":"pong"}');
                    break;
                case 'string':
                    var audio = document.getElementById("bgMusic");                        
                    //重新播放
                    audio.currentTime = 0;
                    audio.play();
                    toastr.info(data.data, '消息提示');
                    break;
                // 当mvc框架调用GatewayClient发消息时直接alert出来
                default :
                    // alert(e.data);
            }
        };
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
        });
        
    </script>
    {block name="script"}{/block}
</body>

</html>
